<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="__CSS__/ex/common.css">
    <link rel="stylesheet" href="__CSS__/ex/login.css">
    <title>WESTGOLDB.EXC</title>
    <script src="__JS__/ios-web-app.js"></script>
</head>

<body style="padding-top: 38px">
<div class="login" style="background:#1A68B3">
    <div class="header">
        <div class="header_left"><a href="javascript:history.back(-1)"><img src="__IMG__/ex/back.png" alt=""></a></div>
        <p style="">Create Your Smart Finance</p>
        <!--<p style="padding-left: 3.5rem;float: right;">开户</p>-->
        <div class="header_right"></div>
    </div>
    <div class="loginform register">
        <div class="form_content username">
            <img src="__IMG__/ex/user.png" alt="">
            <div class="line"></div>
            <input type="text" placeholder="Username" id="username">
        </div>
        <!--<div class="form_content username">-->
        <!--<img src="__IMG__/ex/pay.png" alt="">-->
        <!--<div class="line"></div>-->
        <!--<input type="text" placeholder="请输入钱包名称" id="wallet_name">-->
        <!--</div>-->
        <!--<div class="form_content username">-->
        <!--<img src="__IMG__/ex/mobile.png" alt="">-->
        <!--<div class="line"></div>-->
        <!--<select class="selectchoose" name="phone_ex" id="phone_ex" style="width: 1.3rem">-->
        <!--<volist name="mobile_prefix" id="vv">-->
        <!--<option value="{$vv.mobile_prefix}">+{$vv.mobile_prefix}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{$vv.country}</option>-->
        <!--</volist>-->
        <!--                    <option value="86">+86</option>-->
        <!--                    <option value="0084">+0084</option>-->
        <!--                    <option value="0060">+0060</option>-->
        <!--                    <option value="00855">+00855 </option>-->
        <!--                    <option value="0066">+0066</option>-->
        <!--                    <option value="0065">+0065</option>-->
        <!--                    <option value="0081">+0081</option>-->
        <!--                    <option value="0082">+0082</option>-->
        <!--                    <option value="00856">+00856</option>-->
        <!--                    <option value="0095">+0095</option>-->
        <!--                    <option value="00886">+00886</option>-->
        <!--                    <option value="001">+001</option>-->
        <!--                    <option value="0049">+0049</option>-->
        <!--                    <option value="0033">+0033</option>-->
        <!--</select>-->
        <!--<input type="text" placeholder="请输入手机号 " id="phone">-->
        <!--</div>-->
        <!--<div class="form_content username">-->
        <!--<img src="__IMG__/ex/pwd.png" alt="">-->
        <!--<div class="line"></div>-->
        <!--<input type="number" name="code2" class="input-1 code" id="code" placeholder="请输入验证码" style="width: 50%" />-->
        <!--<div class="line"></div>-->
        <!--<div class="getCode get-code" style="color: white;width: 40%;text-align: center" id="getCode">获取验证码</div>-->
        <!--</div>-->
        <div class="form_content username">
            <img src="__IMG__/ex/pwd.png" alt="">
            <div class="line"></div>
            <input type="email" placeholder="Email " id="email">
        </div>
        <div class="form_content username">
            <img src="__IMG__/ex/pwd.png" alt="">
            <div class="line"></div>
            <input type="number" name="code2" class="input-1 code" id="code1" placeholder="Verification Code" style="width: 50%" />
            <div class="line"></div>
            <div class="getCode1 get-code" style="color: white;width: 40%;text-align: center" id="getCode1">Get Code</div>
        </div>
        <div class="form_content username">
            <img src="__IMG__/ex/pwd.png" alt="">
            <div class="line"></div>
            <input type="password" placeholder="Password " id="password">
        </div>
        <div class="form_content username">
            <img src="__IMG__/ex/pwd.png" alt="">
            <div class="line"></div>
            <input type="password" placeholder="Confirm Password " id="password_re">
        </div>
        <div class="form_content username">
            <img src="__IMG__/ex/pay.png" alt="">
            <div class="line"></div>
            <input type="password" placeholder="Pay Password " id="password2">
        </div>
        <div class="form_content username">
            <img src="__IMG__/ex/recom.png" alt="">
            <div class="line"></div>
            <input type="text" placeholder="Invite Code " id="higher" value="{$higher}">
        </div>
        <div class="" style="color: white;text-align: left;padding-left: 10%">
            <input type="checkbox" name="" id="check" style="-webkit-appearance: checkbox;" />&nbsp;&nbsp;<span id="open">Create account statement</span>
        </div>

        <div class="btn login_btn lsub" id="sub">Create</div>
    </div>
</div>
<style>
    .selectchoose{
        background-color: transparent;
        color: #A9A9A9;
        border: 1px solid #eaeaea;
        height: .6rem;
        line-height: .6rem;
        -webkit-border-radius: .04rem;
        -moz-border-radius: .04rem;
        border-radius: .04rem;
        padding: 0 .08rem;
        margin-right: .08rem;
    }
    .header{
        justify-content: space-between;
    }
    .btn.login_btn.lsub{
        margin-top:.3rem
    }

</style>
<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
<script src="/Public/lib/layer/layer.js"></script>
<script>
    $(function() {
        //发送验证码
        $("#getCode").on('click', function () {
            var num = 60;
            var that = $(this);
            var phone = $('#phone').val();
            var phone_ex=$("#phone_ex").val();
            // console.log(phone_ex);return false;
            if (phone == '') {
                alert('Please enter registered mobile phone number');
            }
                // else if (!(/^1[34578]\d{9}$/.test(phone))) {
                //     alert('手机号码格式不正确');
            // }
            else {
                // var timer = setInterval(function () {
                //     that.attr('id', '');
                //     that.text(num + 's');
                //     that.addClass('active');
                //     num--;
                //     if (num == 0) {
                //         that.attr('id', 'getCode');
                //         clearInterval(timer);
                //         that.text('重新发送');
                //     }
                // }, 1000);
                $.post("{:U('Public/sendCode2')}", {"phone": phone,"phone_ex":phone_ex}, function (data) {
                    alert(data.message);
                    console.log(data)
                    var timer = setInterval(function () {
                        that.attr('id', '');
                        that.text(num + 's');
                        that.addClass('active');
                        num--;
                        if (num == 0) {
                            that.attr('id', 'getCode');
                            clearInterval(timer);
                            that.text('Resend');
                        }
                    }, 1000);
                })
            }
        });
        $("#getCode1").on('click', function () {
            var num = 60;
            var that = $(this);
            var email = $('#email').val();
            if (email == '') {
                alert('Please enter registered email address');
            }
                // else if (!(/^1[34578]\d{9}$/.test(phone))) {
                //     alert('手机号码格式不正确');
            // }
            else {
                // var timer = setInterval(function () {
                //     that.attr('id', '');
                //     that.text(num + 's');
                //     that.addClass('active');
                //     num--;
                //     if (num == 0) {
                //         that.attr('id', 'getCode');
                //         clearInterval(timer);
                //         that.text('重新发送');
                //     }
                // }, 1000);
                $.post("{:U('Public/send_email')}", {"email": email}, function (data) {
                    alert(data.message);
                    console.log(data)
                    var timer = setInterval(function () {
                        that.attr('id', '');
                        that.text(num + 's');
                        that.addClass('active');
                        num--;
                        if (num == 0) {
                            that.attr('id', 'getCode1');
                            clearInterval(timer);
                            that.text('Resend');
                        }
                    }, 1000);
                })
            }
        });
        $("#open").click(function () {
            layer.open({
                type:1,
                anim:1,
                area:['80%','80%'],
                // title:'开户协议',
                title:'Create account statement',
                content:'<div style="padding: 0 .3rem"><p>' +
                    // '<h1>HBK创建声明</h1>' +
                    '<br/><b>Acceptance clause</b><br/>'+
                    ' <br/>The consulting services provided by HBK are subject to the following terms of use. HBK reserves the right to update at any time without prior notice.<br/>' +
                    '<br/><b>Service description</b><br/>'+
                    '<br/>Through its online consulting service, HBK allows you to share various resources, including online and offline resource sharing exchange forums and product information (hereinafter referred to as "services"). Services (including any updates or additions to any new network information) are subject to unconditional restrictions.<br/>' +
                    '<br/><b>Use of services</b><br/>'+
                    '<br/>The service may include consulting service or other information for users\' reference only.<br/>' +
                    '<br/>1. The user confirms that all information provided is true, correct and complete.<br/>' +
                    '<br/>2. At the time of creation, the user has obtained the relevant terms and conditions, and will be bound by the relevant terms and conditions. The user confirms that he has read, understood and accepted the above terms and conditions.<br/>' +
                    '<br/>3.If the user\'s email and other information changes, the user will contact customer service and re submit the application to update the above information.<br/>' +
                    '<br/>4.Customer hereby agrees that HBK shall have the right to charge customer for the services provided at such rates as may be notified from time to time. All fees receivable will be deducted from the user\'s HBK account, and the service fee will be withheld by HBK. The service fee will be adjusted according to the policies and laws of various governments.<br/>' +
                    '<br/>5.The user declares that the user did not have any bankruptcy behavior when opening the account。 <br/>' +
                    '<br/>6.For the email information sent to the user, the user agrees to check and feedback any relevant information。<br/>' +
                    '<br/>7.If the user account is abnormal, HBK has the right to close all transactions of the user。<br/>' +
                    '<br/>8.The right of final interpretation belongs to HBK。<br/>' +
                    '<br/><b>Restrictions on personal and non-commercial use</b><br/>'+
                    '<br/>The service is for personal and non-commercial use only. You may not modify, copy, distribute, transmit, display, execute, publish, license, transfer, sell or create derivative products based on any information, product or service obtained from the service.<br/>' +
                    '<br/><b>Privacy and personal information protection</b><br/>'+
                    '<br/>We attach great importance to your privacy. This privacy statement describes the personal data processed by HBK and how and why HBK processes personal data。<br/>' +
                    '<br/><b>About the service statement provided by this website</b><br/>'+
                    '<br/>This website (hereinafter referred to as "we"), we only provide consulting services for users. We will not be responsible if the end-user himself has any contact that has nothing to do with us. Our consulting service is only for users\' reference. The law explicitly forbids users to copy or redistribute in violation of the license, which may lead to serious civil and criminal penalties. Violators will be prosecuted to the maximum extent possible.<br/>' +
                    '<br/><b>It shall not be used for illegal or prohibited purposes</b><br/>'+
                    '<br/>When using the service, you shall not use the service for any illegal purpose or for any purpose prohibited by these terms, conditions and statements. In using the service, any HBK ownership rights shall not be damaged, prohibited, overloaded or obstructed in any way. You shall not obtain or attempt to obtain any data or information not explicitly provided by the service by any means.<p/>' +

                    '</div>',
                btn:['Read'],
            })
        })
        $('#sub').click(function(){
            if (!$("#check").prop('checked')){
                layer.msg('Please agree to the account opening statement first');
                return false
            }
            var password = $("#password").val()
            // if (!/^[a-z0-9]{6,}$/.test(password)){
                if (!/[0-9A-Za-z]{8,}/.test(password)){
                layer.msg('The password is 8 digits + password')
                return  false
            }
            $.ajax({
                type:"post",
                url:"{:U('register')}",
                data:{
                    username:$('#username').val(),
                    // wallet_name:$("#wallet_name").val(),
                    // phone_ex:$("#phone_ex").val(),
                    // phone:$('#phone').val(),
                    // code:$('#code').val(),
                    code1:$('#code1').val(),
                    email:$('#email').val(),
                    password:$('#password').val(),
                    password_re:$("#password_re").val(),
                    password2:$('#password2').val(),
                    higher:$('#higher').val(),
                },
                dataType:"json",
                success:function(data){
                    if(data.code==1){
                        alert(data.msg);
                    }else{
                        alert(data.msg);
                        window.location.href=data.data;
                    }
                }
            });
        });

        $('#password_re').blur(function(){
            if($('#password').val() !== $('#password_re').val()){
                layer.msg('The two passwords are inconsistent')
            }else{

            }

        })
    })
</script>
</body>

</html>